<?php
require_once($_SERVER['DOCUMENT_ROOT']."/defaultconf.mex");
MYTCONN(); 
include("main.obj.mex");
include("nav.views.mex");

	if (!isset($_POST['Time'])) {
		$_POST['Time'] = date("Y-m-01");
		$_POST['TimeEnd'] = date("Y-m-d");
	}
	if (!isset($_POST['RateStart'])) {
		$_POST['RateStart'] = 0.0000;
		$_POST['RateEnd'] = 0.0000;
	}
	if (!isset($_POST['Offices'])) {
		$_POST['Offices'] = '';
	}
	if (!isset($_POST['Curr'])) {
		$_POST['Curr'] = '';
	}
	if (!isset($_POST['ExcStatus'])) {
		$_POST['ExcStatus'] = '';
	}
	

form_pr('PostSell','',$GLOBALS['URL'].'Lib/rs_console.mex','post');?>
<table width="100%"  border="0" cellpadding="5" cellspacing="0">
        <tr bgcolor="#F2F2F2">
          <td width="8%">Periodo: </td>
          <td width="37%">De
          <?php
		  mn_field('date','ED','Time',$_POST['Time'],'10','8','','');
		  echo ' At�  ';
		  mn_field('date','ED','TimeEnd',$_POST['TimeEnd'],'10','8','',''); ?></td>
          <td width="55%">Tipo:
            <select name="select">
              <option value="ref">Opera��o</option>
              <option value="malote">Lote</option>
              <option value="dep_ref">Deposito</option>
              <option value="profit_ref">Venda</option>
            </select></td>
  </tr>
        <tr bgcolor="#F2F2F2">
          <td>Moeda: </td>
          <td><?php
		$Qur = "SELECT miso_Cod_elite AS ID, miso_ID AS NAME FROM hd_monedasiso WHERE miso_Cod_elite > 0";
		mn_field('select','ED','Curr',$_POST['Curr'],$Qur,'Todas','','" style="width=200px" onchange="'); ?></td>
          <td>&nbsp;</td>
        </tr>
        <tr bgcolor="#F2F2F2">
          <td>Lojas:</td>
          <td><?php
		$Qur = "SELECT ref AS ID, name AS NAME FROM systemoffice.main_offices WHERE Type = 1";
		mn_field('select','ED','Offices',$_POST['Offices'],$Qur,'Todas','','" style="width=200px" onchange="'); ?></td>
          <td>C&acirc;mbio: Entre
		  <?php
		    mn_field('text','ED','RateStart',$_POST['RateStart'],'10','4','','');
			echo ' e ';
			mn_field('text','ED','RateEnd',$_POST['RateEnd'],'10','4','',''); ?></td>
          </tr>
        <tr bgcolor="#F2F2F2">
          <td>Estado: </td>
          <td><?php
		$Qur = "SELECT ID AS ID, NAME AS NAME FROM exchange_status";
		mn_field('select','ED','ExcStatus',$_POST['ExcStatus'],$Qur,'Todos','','" style="width=200px" onchange="'); ?></td>
          <td>
		  <?php 
		  mn_field('button','ED','List','Consultar','','','','" onClick="document.PostSell.action=\''.$GLOBALS['URL'].'Lib/list_console.mex\';subform(\'PostSell\',\'LOS\');'); 
		  mn_field('button','ED','List','Imprimir','','','','" onClick="
		  	
		  	window.open(\''.$GLOBALS['URL'].'Aplications/Media/Print_EXCORD.mex?T1=\'+document.PostSell.Time.value+\'&T6=\'+Curr.value+\'&T2=\'+document.PostSell.TimeEnd.value+\'&T3=\'+document.PostSell.RateStart.value+\'&T4=\'+document.PostSell.RateEnd.value+\'&T5=\'+document.PostSell.select.value+\'&OF=\'+Offices.value+\'&ST=\'+ExcStatus.value,\'_blANK\');'); ?></td>
          </tr>
</table>
<table width="100%"  border="0" cellpadding="1" cellspacing="3" bgcolor="#D3E9BC">
    <tr>
      <td bgcolor="#FFFFFF">
	  <DIV id="Properties"></DIV>
	  <DIV id="Result"><?php include('Lib/rs_console.mex'); ?></DIV></td>
    </tr>
    <tr>
      <td bgcolor="#FFFFFF"><DIV id="LOS"><?php include('Lib/list_console.mex'); ?></DIV></td>
    </tr>
</table>
</form>